//
//  CommentCell.m
//  WXMovie
//
//  Created by HZApple on 16/4/9.
//  Copyright © 2016年 无限互联. All rights reserved.
//

#import "CommentCell.h"


@interface CommentCell () {
    
        UIImageView *imageView;
        UILabel *nameLabel;
        UILabel *ratingLabel;
        BOOL flag;
    
}

@end

@implementation CommentCell



-  (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor clearColor];
        [self _createUI];
    }
    return self;
}
- (void)setModel:(CommentModel *)model {
    
    _model = model;
    nameLabel.text = _model.nickName;
    ratingLabel.text = _model.rating;
    [imageView sd_setImageWithURL:[NSURL URLWithString:_model.imageString]];
    _contentLabel.text = _model.content;
    
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)_createUI {
    imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 4, 50, 50)];
    imageView.layer.cornerRadius = 5;
    imageView.layer.masksToBounds = YES;
    [self addSubview:imageView];
    
    _view = [[UIView alloc] initWithFrame:CGRectMake(70, 4, kScreenWidth - 80, 50)];
    _view.backgroundColor = [UIColor whiteColor];
    _view.layer.cornerRadius = 5;
    [self addSubview:_view];
    
    nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 300, 16)];
    nameLabel.textColor = [UIColor orangeColor];
    nameLabel.font = [UIFont systemFontOfSize:14];
    [_view addSubview:nameLabel];
    
    ratingLabel = [[UILabel alloc] initWithFrame:CGRectMake(290, 10, 60, 16)];
    ratingLabel.textColor = [UIColor grayColor];
    [_view addSubview:ratingLabel];
    
    _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 25, kScreenWidth - 80, 25)];
    _contentLabel.font = [UIFont fontWithName:@"Heiti SC" size:16];
    [_view addSubview:_contentLabel];
    
    flag = NO;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
